<?php
/**
 * Eka Framework 0.3.0
 *
 * @copyright Copyright (c) 2008 Alexey Yu. Chuprina <656b61@gmail.com> (http://php-eka.googlecode.com)
 * @license http://www.opensource.org/licenses/mit-license.php MIT License
 *
 * @version $Id$
 */

/**
 * Eka_Application_View_Interface
 *
 * @package Application
 * @subpackage View
 */
interface Eka_Application_View_Interface
{
	/**
	 * Constuctor
	 *
	 * @param Eka_Application_Controller $controller
	 * @param string $file Template file
	 * @param string $layout Layout file
	 */
	public function __construct(Eka_Application_Controller $controller, $file, $layout = null);
	
	/**
	 * Assign a variable
	 *
	 * @param string $key Variable name
	 * @param mixed $val Variable value
	 * @return void
	 */
	public function __set($key, $val);
	
	/**
	 * Get assigned variable value
	 *
	 * @param string $key Variable name
	 * @return mixed
	 */
	public function __get($key);
		
	/**
	 * Allows testing with empty() and isset() to work
	 *
	 * @param string $key Variable name
	 * @return boolean
	 */
	public function __isset($key);

	/**
	 * Allows unset() on object properties to work
	 *
	 * @param string $key Variable name
	 * @return void
	 */
	public function __unset($key);
	
	/**
	 * Assign variables
	 *
	 * @see __set()
	 * @param string|array $key Variable name or array of key => value pairs
	 * @param mixed $value (Optional) If assigning a named variable, use this as the value
	 * @return Eka_Application_View_Interface
	 */
	public function set($key, $value = null);
	
	/**
	 * Get assigned variable value
	 *
	 * @see __get()
	 * @param string $key Variable name
	 * @return mixed
	 */
	public function get($key);
	
	/**
	 * Assign layout variables
	 *
	 * @param string|array $key Variable name or array of key => value pairs
	 * @param mixed $value (Optional) If assigning a named variable, use this as the value
	 * @return Eka_Application_View_Interface
	 */
	public function setLayoutVar($key, $value = null);
	
	/**
	 * Get assigned layout variable value
	 *
	 * @param string $key Variable name
	 * @return mixed
	 */
	public function getLayoutVar($key);
	
	/**
	 * Use layout or not
	 *
	 * @param bool $is
	 * @return bool
	 */
	public function useLayout($is = null);
	
	/**
	 * @return Eka_Application
	 */
	public function getApplication();

	/**
	 * @return Eka_Application_Request
	 */
	public function getRequest();
	
	/**
	 * @return Eka_Application_Response
	 */
	public function getResponse();
	
	/**
	 * @return Eka_Application_Controller
	 */
	public function getController();
	
	/**
	 * Processes a view script and returns the output.
	 *
	 * @return string The script output.
	 */
	public function execute();
}